package baseFx.tests.job;

import baseFx.common.concurrent.Task;
import baseFx.job.FxJob;
import baseFx.job.JobStopException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class Test3Job implements FxJob {
    private static Logger logger = LoggerFactory.getLogger(Test3Job.class);
    private static int index;

    private boolean exit;

    @Override
    public void run() {
        if (exit) {
            return;
        }
        Task.delay(2000);
        synchronized (Test3Job.class) {
            index++;
            logger.error("" + index);
        }
        throw new JobStopException();
    }
}
